mui.init();
var mime = {
	onopen : function(){
		tokens = getToKen();
	    var json_data = {
	    	"type" : "getuserinfo",
	    	"uid" : tokens['userid'],
	    	"username" : tokens["username"],
	    	"token" : tokens['token'],
	    	'room_id' : 'default',
	    };
	    ws.send(JSON.stringify(json_data));
	},
	onmessage : function(e){
		var data = eval("("+e.data+")");
		console.log(JSON.stringify(data));
	    switch(data['type']){
	        case 'getuserinfo':
	            if(data.state != 200){
			    	mui.toast(info[data.msgid]);
			    	return false;
			    }
	            document.getElementById('userid').innerText = data.uid;
	            document.getElementById('username').innerText = data.username;
	            document.getElementById('nickname').innerText = data.nickname;
	            document.getElementById('usercoin').innerText = data.coin;
	            break;
	    }
	},
};
mui.plusReady(function(e){
	document.addEventListener('loginSuccess',function(e){
		room_connect(mime.onopen,mime.onmessage);
	},false);
});
